package cn.com.huzo.repository.purchase.impl;

import cn.com.huzo.model.entities.purchase.PoLinesMrpFeedingEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.purchase.PoLinesMrpFeedingRepository;

/**
 * 采购订单-引入的补料单主表数据访问对象。
 *
 * @author 吴旭
 */
@Repository("PoLinesMrpFeedingRepository")
public class PoLinesMrpFeedingRepositoryImpl extends GenericRepositoryImpl<PoLinesMrpFeedingEntity, String>
        implements PoLinesMrpFeedingRepository {

    private final String namespace = "cn.com.huzo.repository.purchase.PoLinesMrpFeedingRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public PoLinesMrpFeedingRepositoryImpl() {
        super(PoLinesMrpFeedingEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<PoLinesMrpFeedingEntity> fetchByHeaderId(Long headerId) {
        Map<String, Object> criterion = new HashMap();
        criterion.put("HeaderId", headerId);

        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderId"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<PoLinesMrpFeedingEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    public Integer deleteInvalidRow(Long headerId) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "deleteInvalidRow"), headerId);
    }
}
